package com.mvvm.store.ui.delivery.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;

import com.lihang.nbadapter.BaseAdapter;
import com.mvvm.store.R;
import com.mvvm.store.base.BaseViewHolder;
import com.mvvm.store.bean.basebean.DeliveryInfoBean;
import com.mvvm.store.bean.basebean.DeliveryResultBean;
import com.mvvm.store.bean.basebean.Rows;
import com.mvvm.store.databinding.ItemDeliverySweptBinding;
import com.mvvm.store.databinding.ItemOutBoundBinding;

public class OutBoundManagerAdapter extends BaseAdapter<Rows> {
    //接口
    private ClickInterface clickInterface;
    //--------------------点击事件-------------------------------------------//
    public void setOnclick(ClickInterface clickInterface) {
        this.clickInterface = clickInterface;
    }
    //回调接口
    public interface ClickInterface {
        void onImagesClick(View view, int position, Rows materialInfoBean);

        void onItemClick(View view, int position, Rows materialInfoBean);
    }
    @Override
    public RecyclerView.ViewHolder getViewHolder(ViewGroup viewGroup, int viewType) {
        ItemOutBoundBinding itemOutBoundBinding= DataBindingUtil.inflate(LayoutInflater.from(viewGroup.getContext()), R.layout.item_out_bound, viewGroup, false);
        return new BaseViewHolder(itemOutBoundBinding);
    }

    @Override
    public void onBindMyViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
        BaseViewHolder baseViewHolder = (BaseViewHolder) viewHolder;
        ItemOutBoundBinding itemOutBoundBinding=(ItemOutBoundBinding) baseViewHolder.binding;
        Rows materialInfoBean=dataList.get(i);
        itemOutBoundBinding.tvOddNumber.setText(materialInfoBean.getOutStockOrderNo()+"");
       // itemMaterialSweptBinding.tvMaterialSnpNumber.setText(materialInfoBean.getSnpNumber()+"");
       // itemMaterialSweptBinding.tvSumNumber.setText(materialInfoBean.getSumNumber()+"");
      //  itemOutBoundBinding.tvPackNumber.setText(materialInfoBean.getPackNumber()+"");
       // itemMaterialSweptBinding.tvLableNumber.setText(materialInfoBean.getLableNumber()+"");
            itemOutBoundBinding.llOutBound.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(clickInterface!=null){
                    clickInterface.onImagesClick(v,i,materialInfoBean);
                }
            }
        });

    }
}
